02. Build Your Project

Build Your Project
For this project, you'll be creating a Rube Goldberg Game that challenges players to create contraptions capable of guiding a ball through several collectibles and into a goal.
Here are step-by-step directions to creating your Rube Goldberg Game:
Download the Starter Pack
- Download the High Immersion Starter Project ZIP file
- Unzip the Starter Pack ZIP file to a convenient location on your computer.
- Open up the ZIP and load the scene titled Assets\Scenes\ExampleScene.unity
- You’ll see a factory environment.
Initial Setup
- Import SteamVR and drag the CameraRig prefab into the scene
- Create a new script called ControllerInputManager and attach it to both hands (alternatively, you can attach it to only the CameraRig if you feel comfortable with the events delegate pattern)
Add Teleportation
- Make write teleportation code into ControllerInputManager that:
- Activates by pressing the left Touchpad
- Shows an aim indicator (such as a laser) coming from the left controller while the left Touchpad is held down
- Shows an indicator of where the player will teleport while the left Touchpad is held down
- Moves the player to the aimed-at position on left Touchpad release
- Review the earlier course materials if you’re uncertain how to do these steps
Add Object Grabbing and Throwing
- Put a ball on your platform (inside the player’s initial play space) that resets its position when it hits the ground
- Find the ball model, attach a rigidbody, and place it on or above the player’s platform (optionally you can create a pedestal for it so you don’t have to bend down to the floor to pick it up)
- Tag the ball as “Throwable” and the ground as “Ground”
- Attach a script to the ball called BallReset which resets the position and velocity of the ball to its starting point when it hits the ground (hint: use OnCollisionEnter with a tag check)
- Use scripting so that both hands can pick up and throw the ball by pressing and releasing trigger
- Attach sphere colliders to the hands, mark the colliders as triggers
- Use OnTriggerStay with a “Throwable” tag check and other conditionals taught in this lesson so that you can pick up and throw the ball
- Note: If you have a controller manager attached to each controller, all your input code will be in this one script, with a bool used to check which hand is being used for code specific to one hand.
Create at least 4 Rube Goldberg objects
- Make 4 GameObject prefabs that contain different geometry, color, and physics functionality (recommended to use isKinematic rigidbodies)
- Think about how different shapes, physics materials, code, and more can be used to change the way someone will build a contraption to get to the goal (for example, a teleporter block). GET CREATIVE!
Create an Object Menu
- Create a menu system attached to the right hand that appears or disappears depending on whether your thumb is touching the trackpad, and that can cycle forwards or backwards between different objects. When an object is selected, you should be able to spawn a copy of it with a button press.
- Attach an empty GameObject to the right controller called “ObjectMenu”
- Create an empty GameObject for each of your Rube Goldberg objects and make them children of “ObjectMenu”
- Take your 4 Rube Goldberg objects and make them children of their respective empty GameObjects, placing them so they’re easily visible above the player’s controller
- Under each of the 4 empty GameObjects titled after your Rube Goldberg objects, create a UI Text element, place it in a readable location above or below its respective Rube Goldberg object, and create description text for each object (should be very short, such as “Plank” or “Portal”)
- In “ControllerInputManager” create an if statement (in the update function) that disables ObjectMenu when your finger is lifted from the right Touchpad, and enables it when your finger touches the right Touchpad
- Create a List to contain ObjectMenu UI elements (which will be the empty GameObjects directly under ObjectMenu)
- For the right hand, write code that detects whether your thumb is on the left or right side of the trackpad when pressing down, and have such presses move forwards or backwards in the ObjectMenu UI List depending on which is true (pressing forward or backward should disable the current UI element and enable the one it’s switching to)
- If the ObjectMenu UI is visible, allow the player to spawn a prefab by pressing Right Trigger
- If you’re having trouble with some of this, check out Menu Systems and Input Axis
Fix Object Grabbing for Rube Goldberg objects
- Write a special case for grabbing Rube Goldberg objects if necessary
- Make sure Rube Goldberg object rigidbodies are set to isKinematic
- Tag Rube Goldberg objects as “Structure”
- Write code in ControllerInputManager that works the same way as prior grab code but that DOESN’T modify rigidbody velocity on release
- Remove the colliders from ObjectMenu Rube Goldberg objects so they can’t interfere with the environment (the Prefabs should NOT have their colliders removed)
Gameplay
- Create a collectible object (ex. star) that disappears when hit by the ball and make it a prefab, placing at least two in the scene
- Write code that re-enables all collectibles when the ball hits the ground
- Hint: A likely home for this code is in the BallReset script
- Create a goal that loads the next level when hit by the ball IF all the stars have been hit first without the ball touching the ground
- Every time the ball hits the ground, the goal should know that the number of stars hit has been reset.
Make sure you use SteamVR’s load function (Although you should use SteamVR for the Rift too, if you were developing for the Rift specifically, you'd use a fade to black between scene changes here).
- Every time the ball hits the ground, the goal should know that the number of stars hit has been reset.
- Create anti-cheat code that prevents you from scoring by any other means than releasing the ball from the platform area
- I recommend you change the ball’s color when this anti-cheat code fires so that the player knows they’ll have to throw the ball at the ground to reset (and to make testing it easier)
- For example, if the ball is released from a throw outside the platform zone, change it’s layer to one which cannot collide with the goal, resetting it’s layer when the Ball hits the Ground
- Make at least 4 different levels
- Limit the number of each Structure (menu object) you can spawn depending on the level (for example, maybe Level 1 you get 2 of each object, but Level 2 you get 4 of one object but 1 of each of the others)
- Vary the number and position of collectibles depending on the level
Final Polish
- Create UI for the first level that instructs the player how to play
- Put effort into making your environment and objects cool/pretty
- Make sure the game runs at 90fps (if it doesn’t you probably have too many environmental objects in the scene, or are allowing way too many objects to be spawned by the player)
- Create an Oculus build and/or a Vive build using SteamVR. Make sure they work correctly.
README File
You must also put a README.md in the top directory. In it, please include your name, how long it took to complete the project, and one thing you liked and one thing that was challenging about this project. Feel free to tell the reviewer which system you used to test and develop your project (Oculus, Vive, or Both) although the project will be reviewed with SteamVR.